In many data processing applications, signals are communicated in a pulse width modulated format. In the pulse width modulated format, information is transmitted in both high and low level pulses which have varying lengths. The length of the pulses are then translated into a more meaningful value for subsequent use.
In implementations which use a counter to measure the length of the pulses, the length of either the high or the low pulses of an input signal are measured while the pulse is asserted. For example, to determine a length of a high pulse, the counter generally begins counting the cycles of an independent clock signal on a rising edge of the input signal. Subsequently, the counter stops counting on the falling edge of the input signal. The counter then provides the count value to an external user and is reset to begin counting again on the next rising edge of the input signal. Similarly, to determine a length of a low pulse of the input signal, the counter generally begins counting the cycles of the clock signal on a falling edge of the input signal. Subsequently, the counter stops counting on the rising edge of the input signal. The counter then provides an external user with the count value and is reset to begin counting again on a next falling edge of the input signal.
Because the counter must be reset before a new count may begin, measuring of consecutive high and low pulses is not possible. If information from both high and low pulses is required, a counter measures a length of a high pulse and must then wait a full period before measuring a length of a low pulse. Therefore, whether measuring high or low pulse lengths, a user is only able to receive data from either the high or low pulses. Information contained in the other pulse type must be ignored when a counter is used to determine the length of a pulse.
When essential information is transferred on both high and low pulses, the information contained in either pulse type may not be ignored. In such applications, a timer circuit which is programmable is used to measure consecutive pulses. The timer circuit may be programmed to measure consecutive pulses of the input signal through software. However, when a timer circuit is used, the frequency of the pulses is limited by the processing time required to execute the software program. The pulses must be at least as long as the time required to execute the software program. Additionally, circuitry required to implement a timer circuit is typically much larger than the circuitry required to implement a counter. As well, the software program controlling execution of the timer circuit may require an excessive amount of memory space. An example of such a timer circuit is provided in a MC68HC05C4 microcontroller unit commercially available from Motorola, Inc. of Austin, Tex. The timer circuit in the MC68HC05C4 microcontroller unit includes a sixteen bit software-programmable counter which is driven by a clock prescaler. The timer has an output compare register and an input capture register. For more information about the MC68HC05C4 microcontroller unit, refer to "Motorola Microprocessor, Microcontroller, and Peripheral Data," Volume 1 published in 1988.
Therefore, a need exists for a system which would determine a length of consecutive high and low pulses without excessive circuit area or memory requirements. Additionally, a length of each pulse should be determined and no pulses should be ignored or missed.